package com.ufgov.agcfs.taskPreset.service;


import java.io.FileOutputStream;



import java.io.IOException;
import java.util.HashMap;
import java.util.List;








import java.util.Map;
























import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ufgov.agcfs.taskPreset.dao.AgcfsSjAccBookDao;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjAccAssEntity;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjAccBook;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjAccEntity;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjAccPeriod;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjAssetChangeTypeEntity;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjAssetStatusEntity;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjAssetTypeEntity;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjBank;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjCurEntity;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjDept;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjEmpType;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjExchangeTypeEntity;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjGlDefEntity;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjProj;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjSettlement;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjUserDefDoc;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjUserDefDocValEntity;
import com.ufgov.agcfs.taskPreset.entity.AgcfsSjVouTypeEntity;
import com.ufgov.ip.sysmanager.entity.IpCompany;

@Service
public class AgcfsSjAccBookService {
	@Autowired
	AgcfsSjAccBookDao agcfsSjAccBookDao;
	private FileOutputStream fos;
	public AgcfsSjAccBookDao getAgcfsSjAccBookDao() {
		return agcfsSjAccBookDao;
	}

	public void setAgcfsSjAccBookDao(AgcfsSjAccBookDao agcfsSjAccBookDao) {
		this.agcfsSjAccBookDao = agcfsSjAccBookDao;
	}
	//电子帐薄
	public List<AgcfsSjAccBook> selectSjAccBookInfo(Map<?, ?> param){
		return agcfsSjAccBookDao.selectSjAccBookInfo(param);
	}
	
	public List<String>  queryYears(){
		return agcfsSjAccBookDao.queryYears();
	}
	
	//public List<IpCompany> selectIpCompInfo(){
		//return agcfsSjAccBookDao.selectIpCompanyInfo();
	//}
	//查询单位名称
	public List<String> selectCoName(){
		return agcfsSjAccBookDao.selectCoName();
	}
	//提供给其它的Controller查询部门编号
	public String selectCoCode(String coName){
		return agcfsSjAccBookDao.selectCoCode(coName);
	}
	//查询parent_co_id、co_name
	public List<String> selectNamePC(String coCode){
		return agcfsSjAccBookDao.selectNamePC(coCode);	
	}
	
	//只查询会计期间
	public List<AgcfsSjAccPeriod> selectSjAccPeriod(Map<?, ?> param){
		return agcfsSjAccBookDao.selectSjAccPeriod(param);
	}
	//只查询银行账户信息
	public List<AgcfsSjBank> selectSjAccBank(Map<?, ?> param){
		return agcfsSjAccBookDao.selectSjAccBank(param);
	}
	//只查询结算方式信息
		public List<AgcfsSjSettlement> selectSjSettlement(Map<?, ?> param){
			return agcfsSjAccBookDao.selectSjSettlement(param);
		}
		//只查询内设机构信息
				public List<AgcfsSjDept> selectAgcfsSjDept(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjDept(param);
				}
				//只查询职工类型信息
				public List<AgcfsSjEmpType> selectAgcfsSjEmpType(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjEmpType(param);
				}
				//只查询项目信息
				public List<AgcfsSjProj> selectAgcfsSjProj(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjProj(param);
				}
				//只查询自定义档案项信息
				public List<AgcfsSjUserDefDoc> selectAgcfsSjUserDefDoc(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjUserDefDoc(param);
				}
				//只查询自定义档案值信息
				public List<AgcfsSjUserDefDocValEntity> selectAgcfsSjUserDefDocVal(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjUserDefDocVal(param);
				}
				//只查询币种信息
				public List<AgcfsSjCurEntity> selectAgcfsSjCur(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjCur(param);
				}
				//只查询汇率类型信息
				public List<AgcfsSjExchangeTypeEntity> selectAgcfsSjExchangeType(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjExchangeType(param);
				}
				//只查询总账基础信息
				public List<AgcfsSjGlDefEntity> selectAgcfsSjGlDef(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjGlDef(param);
				}
				//只查询记账凭证类型
				public List<AgcfsSjVouTypeEntity> selectAgcfsSjVouType(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjVouType(param);
				}
				//只查询会计科目
				public List<AgcfsSjAccEntity> selectAgcfsSjAcc(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjAcc(param);
				}
				//只查询科目辅助核算
				public List<AgcfsSjAccAssEntity> selectAgcfsSjAccAss(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjAccAss(param);
				}
				//只查询固定资产类别
				public List<AgcfsSjAssetTypeEntity> selectAgcfsSjAssetType(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjAssetType(param);
				}
				//只查询固定资产变动方式
				public List<AgcfsSjAssetChangeTypeEntity> selectAgcfsSjAssetChangeType(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjAssetChangeType(param);
				}
				//只查询固定资产使用状况
				public List<AgcfsSjAssetStatusEntity> selectAgcfsSjAssetStatus(Map<?, ?> param){
					return agcfsSjAccBookDao.selectAgcfsSjAssetStatus(param);
				}
				
				//导出Excel
//导出电子帐薄Excel
public  boolean outExcelFile1(String ND,String coName) throws IOException{
	

	HSSFWorkbook workBook=null;
	String[] title={"单位代码","科目体系编码","电子账簿编号","电子账簿名称","会计核算单位","组织机构代码","单位类型","行业","行政区划代码","预算管理级次","经费来源","开发单位","版本号","本位币","会计年度","标准版本号"};

	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
    List<AgcfsSjAccBook> data=agcfsSjAccBookDao.selectSjAccBookInfo(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"电子账簿"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<16;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDW_CODE()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getACC_BOOK_TYPE_CODE()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getACC_BOOK_NO()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getACC_BOOK_NAME()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDW_NAME()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getORG_CODE()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDW_TYPE_NAME()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getHY_NAME()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getADMIN_DIV_CODE()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getBUDG_LEVEL_NAME()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getFUND_SOURCE_NAME()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDEV_DW_NAME()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getVER_NO()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getCUR_NAME()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getND()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getSTD_VER_NO()));
					
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出会计期间Excel
public  boolean outExcelFile2(String ND,String coName) throws IOException{

	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","会计期间号","会计期间起始日","会计期间结束日"};
	
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjAccPeriod> data=agcfsSjAccBookDao.selectSjAccPeriod(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"会计期间"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<5;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccPeriodNo().toString()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDateS()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDateE()));
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出银行账户Excel
public  boolean outExcelFile3(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","开户银行代码","开户银行名称","银行账号","账户类型"};

	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjBank> data=agcfsSjAccBookDao.selectSjAccBank(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"银行账户"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<6;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getBankCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getBankName()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getBankAccNo()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getBankAccType()));
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出结算方式Excel
public  boolean outExcelFile4(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","结算方式编码","结算方式名称"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjSettlement> data=agcfsSjAccBookDao.selectSjSettlement(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"结算方式"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<4;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getSettlementCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getSettlementName()));
				
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出内设机构Excel
public  boolean outExcelFile5(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","内设机构编码","内设机构名称","上级机构编码"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjDept> data=agcfsSjAccBookDao.selectAgcfsSjDept(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"内设机构"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<5;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDeptCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDeptName()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getpDeptCode()));
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出职工类型Excel
public  boolean outExcelFile6(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","职工类型编码","职工类型名称"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjEmpType> data=agcfsSjAccBookDao.selectAgcfsSjEmpType(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"内设机构"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<4;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getEmpTypeCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getEmpTypeName()));
			
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出项目Excel
public  boolean outExcelFile7(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","项目编码","项目名称","级次","项目类型","项目类别","项目属性","会计期间起始日期","会计期间结束日期"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjProj> data=agcfsSjAccBookDao.selectAgcfsSjProj(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"项目"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<10;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getProjCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getProjName()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getProjLevel()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getProjType()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getProjClass()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getProjProp()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDateS()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDateE()));
			   
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出自定义档案项Excel
public  boolean outExcelFile8(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","档案编码","档案名称","档案描述","是否有层级特征","档案编码规则"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjUserDefDoc> data=agcfsSjAccBookDao.selectAgcfsSjUserDefDoc(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"自定义档案项"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<7;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDocCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDocName()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDocDesc()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getIsCodeLevel()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getCodeRule()));
			  
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出自定义档案值Excel
public  boolean outExcelFile9(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","档案编码","档案值编码","档案值名称","档案值描述","档案值父节点","档案值级次"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjUserDefDocValEntity> data=agcfsSjAccBookDao.selectAgcfsSjUserDefDocVal(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"自定义档案值"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<8;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDocCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDocValCode()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDocValName()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDocValDesc()));
			    k++;
			    cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getpDocValCode()));
			     k++;
			     cell=row.createCell(k);
					cell.setCellValue(new HSSFRichTextString(data.get(t).getDocValLevel().toString()));
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出币种Excel
public  boolean outExcelFile10(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","币种编码","币种名称"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjCurEntity> data=agcfsSjAccBookDao.selectAgcfsSjCur(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"币种"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<4;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getCurCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getCurName()));
			  
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出汇率类型Excel
public  boolean outExcelFile11(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","汇率类型编号","汇率类型名称"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjExchangeTypeEntity> data=agcfsSjAccBookDao.selectAgcfsSjExchangeType(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"汇率类型"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<4;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getExchangeTypeCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getExchangeTypeName()));
			  
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出总账基础信息Excel
public  boolean outExcelFile12(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","电子账薄编号","结构分隔符","凭证头可扩展字段结构","凭证头可扩展结构对应档案","分录行可扩展字段结构","分录行可扩展字段对应档案"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjGlDefEntity> data=agcfsSjAccBookDao.selectAgcfsSjGlDef(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"总账基础信息"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<8;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccBookNo()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getSepMark()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getVouHeadExpStruct()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getVouHeadExpDoc()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getVouDetailExpStruct()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getVouDetailExpDoc()));
				
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出记账凭证类型Excel
public  boolean outExcelFile13(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","电子账薄编号","记账凭证类型编号","记账凭证类型名称","记账凭证类型简称"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjVouTypeEntity> data=agcfsSjAccBookDao.selectAgcfsSjVouType(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"记账凭证类型"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<6;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccBookNo()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getVouTypeCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getVouTypeName()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getVouTypeShortName()));
				
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出会计科目Excel
public  boolean outExcelFile14(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","电子账薄编号","科目编号","科目名称","科目级次","科目类型","余额方向"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjAccEntity> data=agcfsSjAccBookDao.selectAgcfsSjAcc(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"会计科目"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<8;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccBookNo()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccNo()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccName()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccLevel().toString()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccType()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getBalDir()));
				
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出科目辅助核算Excel
public  boolean outExcelFile15(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","电子账薄编号","科目编号","辅助项编号","辅助项名称","对应档案","辅助项描述"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjAccAssEntity> data=agcfsSjAccBookDao.selectAgcfsSjAccAss(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"科目辅助核算"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<8;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccBookNo()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccNo()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccAssNo()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccAssName()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDocName()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAccAssDesc()));
				
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出固定资产类别Excel
public  boolean outExcelFile16(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","固定资产类别编码","固定资产类别名称","固定资产类别编码规则"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjAssetTypeEntity> data=agcfsSjAccBookDao.selectAgcfsSjAssetType(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"固定资产类别"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<5;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAssetTypeCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAssetTypeName()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getAssetTypeCodeRule()));
				
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
//导出固定资产变动方式Excel
public  boolean outExcelFile17(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","变动方式编码","变动方式名称"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjAssetChangeTypeEntity> data=agcfsSjAccBookDao.selectAgcfsSjAssetChangeType(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"固定资产变动方式"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<4;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getChangeTypeCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getChangeTypeName()));
				
				
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}

//导出固定资产使用状况Excel
public  boolean outExcelFile18(String ND,String coName) throws IOException{
	//Map<String , Object> result=new HashMap<String, Object>();
	
	HSSFWorkbook workBook=null;
	String[] title={"单位代码","会计年度","使用状况编码","使用状况名称"};
	//String coName=request.getParameter("CO_NAME");
	//String ND=request.getParameter("ND"); 
	String	DW_CODE=agcfsSjAccBookDao.selectCoCode(coName);
	Map<String , Object> param=new HashMap<String, Object>();
	param.put("DW_CODE", DW_CODE);
	param.put("ND", ND);
	List<AgcfsSjAssetStatusEntity> data=agcfsSjAccBookDao.selectAgcfsSjAssetStatus(param);
	try{
		//导出地址
		fos=new FileOutputStream("D://"+ND+"固定资产使用状况"+".xls");
		workBook=new HSSFWorkbook();   //创建Excel
		HSSFSheet sheet=workBook.createSheet("导出数据情况");     //工作表
		HSSFRow row=sheet.createRow(0);        //行
		HSSFCell cell=null;     //列
		//第一行输入标题
		for(int j=0;j<title.length;j++){
			cell=row.createCell(j);
			cell.setCellValue(new HSSFRichTextString(title[j]));
		}
		//写入数据到excel
		for(int t=0;t<data.size();t++){
			row=sheet.createRow(t+1);
			for(int k=0;k<4;k++){
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getDwCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getNd()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getStatusCode()));
				k++;
				cell=row.createCell(k);
				cell.setCellValue(new HSSFRichTextString(data.get(t).getStatusName()));
				
				
				
			}
		}
		//写入本地
		workBook.write(fos);
		fos.flush();
		fos.close();
		
		return true;
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		fos.flush();
		fos.close();
	}
	return false;
}
}


	
	

